package cn.hwy.societies.biz;

import cn.hwy.societies.mapper.club.ClubDO;
import cn.hwy.societies.mapper.club.ClubMapper;
import cn.hwy.societies.web.club.param.ClubCreateParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

@Service
public class ClubServiceImpl implements IClubService{

    @Autowired
    private ClubMapper clubMapper;


    @Override
    public Boolean add(ClubCreateParam clubParam) {
        Date date = new Date();

        ClubDO clubDO = ClubDO.builder()
                .clubPic(clubParam.getClubPic())
                .name(clubParam.getName())
                .creatorName("xxx")
                .creatorId("xxx")
                .gmtCreate(date)
                .gmtModified(date)
                .introduction(clubParam.getIntroduction())
                .build();
        int insert = clubMapper.insert(clubDO);
        if (insert > 0) {
            return true;
        }
        return false;
    }
}
